﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using ContactManager.Models.Entities;

namespace ContactManager.Models.Validation
{
    public class ContactGroupValidator:IValidator<ContactGroup>
    {
        public ValidationState Validate(ContactGroup groupToValidate)
        {

            ValidationErrorCollection _validationErrorCollection = new ValidationErrorCollection();

            switch (groupToValidate.Name)
            {
                case null: _validationErrorCollection.Add("Group Name", "Group name is required.");
                    break;
                case "":
                    _validationErrorCollection.Add("Group Name", "Group name is required.");
                    break;
            }



           ValidationState _validationState = new ValidationState(_validationErrorCollection);

            return _validationState;


        }

    }
}
